﻿@model  ClientListModel
@{

    var gridPageSize = EngineContext.Current.Resolve<CAF.Infrastructure.Core.Domain.Common.AdminAreaSettings>().GridPageSize;
    //page title
    ViewBag.Title = T("Admin.ArticleCategory.Clients").Text;
    var g = Html.GridToolKit<ClientModel>();
    var grid = g.DataGrid("clientGrid", g.Param(x => x.Id)).TableId("table-id").GridKey("Id").Pager(true)
    .MainGrid(
    g.GridColumn(x => x.Name, 300).DefaultContent("<a href=\"Edit/#Id#\">#Name#</a>"),
    g.GridColumn(x => x.Published, 300),
    g.GridColumn(x => x.DisplayOrder, 300),
    g.GridColumn("operation", "" + T("Admin.Common.Operation").Text + "", 150).DefaultContent("<a href=\"Edit/#Id#\" class='btn default btn-xs purple'><i class='fa fa-edit'></i></a>"))
    .Url(Url.Action("List", "Client")).DefaultTableClass().BindDataParamBinding("onDataBinding");
}
 
@using (Html.BeginForm())
{
    <div class="row">
        <div class="col-md-12">
            <div class="portlet light">
                <div class="section-header sticky">
                    <div class="caption">
                        <i class="icon-equalizer font-red-sunglo"></i>
                        <span class="caption-subject font-red-sunglo bold uppercase">  @T("Admin.ArticleCategory.Clients")</span>
                        <span class="caption-helper"></span>
                    </div>
                    <div class="tools">

                    </div>
                    <div class="actions">
                        <a href="@Url.Action("Create")" class="btn yellow"><i class="fa fa-plus"></i>@T("Admin.Common.AddNew") </a>

                    </div>
                </div>
                <div class="portlet-body form form-horizontal form-bordered form-row-stripped">
                    <div class="portlet">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-search"></i>@T("Admin.Common.Search")
                            </div>
                            <div class="tools">
                           
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="well">
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group">
                                            <label class="control-label col-md-3">@Html.LangLabelFor(model => model.SearchClientName)</label>
                                            <div class="col-md-9">
                                                @Html.TextBoxFor(model => model.SearchClientName, new { @class = "form-control" })
                                            </div>
                                        </div>

                                    </div>
                                    <div class="row">
                                        <div class="col-md-6">
                                            <div class="row">
                                                <div class="col-md-offset-3 col-md-9">
                                                    <button type="submit" id="btnSearch" class="btn btn-default">
                                                        <i class="fa fa-search"></i>
                                                        @T("Admin.Common.Search")
                                                    </button>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-md-6">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="portlet-body flip-scroll">
                        <table id="@grid.GetTableId" class="@grid.GetDefaultTableClass" @Html.Raw(grid.GetFixedLayout ? "style='table-layout:fixed'" : "")>
                            <thead>
                                <tr>
                                    @foreach (var column in grid.GetColumns)
                                    {
                                        if (column.Name == "操作")
                                        {

                                            <th class="@column.CssClassHeader">@column.DisplayName</th>

                                        }
                                        else
                                        {
                                            <th class="@column.CssClassHeader">@column.DisplayName</th>
                                        }

                                    }
                                </tr>

                            </thead>
                            <tbody></tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function onDataBinding() {
            var searchModel = {
                SearchClientName: $('#@Html.FieldIdFor(model => model.SearchClientName)').val(),

            };
            return searchModel;
        }
        @(grid)
        $(document).ready(function () {

            //search button
            $('#btnSearch').click(function () {
                //search
                var grid = clientGrid.reload();
                return false;
            });
        });


    </script>
}
